package com.ymatou.iapi.productprice.service;

import java.util.Arrays;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.MapUtil;

public class GetPriceByProdIdsTradeIsolationForSearchedListCall extends YmatouAutoTestCall implements PriceInterface{

	private static String opurl ="api/Price/GetPriceByProdIdsTradeIsolationForSearchedList";
	
	public GetPriceByProdIdsTradeIsolationForSearchedListCall() {
		super(EnvSetup.getSystemUrl("productprice"),opurl,"POST","JSON");
	}


	@Override
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public JSONObject callAndGetReturnData(int buyerId,List<String> catalogsList){
		JSONObject requestBean = this.getJsonBean(null);
		
		JsonBeanHelper.updateJsonBean(requestBean, MapUtil.hashMap("BuyerId", buyerId,"ProductIds", new JSONArray(catalogsList)));
		
		return callAndGetReturnData(requestBean);
	}
	
	public static void main(String[] args) {
		new GetPriceByProdIdsTradeIsolationForSearchedListCall().callAndGetReturnData();
	}


	@Override
	public JSONObject GetReturnDataByBuyerAndId(int buyerId, String id) {
		return callAndGetReturnData(buyerId,Arrays.asList(id));
	}

}
